aboutsummaryrefslogtreecommitdiff
path: root/_slides/2020-11-14-on-local-first-beyond-the-crdt-silver-bullet.slides
blob: 33fc2399eafc43c2a3d18508275286789ae2280d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
---

title: 'On "local-first": beyond the CRDT silver bullet'

date: 2020-11-14

layout: slides

lang: en

ref: on-local-first-beyond-the-crdt-silver-bullet

article: _articles/2020-11-14-local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.md

---

# On local-first

Beyond the CRDT silver bullet

---

# Part 1

Exposition

---

## "cloud apps" vs "old-fashioned apps"

---

## Target

- documents
- files
- personal data repositories

Not: banking services, e-commerce, social networking, ride-sharing, *etc*.

---

## 7 Ideals for local-first software

---

### 1 - No Spinners: Your Work at Your Fingertips

---

### 2 - Your Work Is Not Trapped on One Device

---

### 3 - The Network Is Optional

---

### 4 - Seamless Collaboration with Your Colleagues

---

### 5 - The Long Now

---

### 6 - Security and Privacy by Default

---

### 7 - You Retain Ultimate Ownership and Control

---

## Towards a Better Future

CRDTs (Conflict-free Replicated Data Types) as a Foundational Technology

---

### Use case

```
# in node A and node B
s = "Hello, World"

# in node A
s = "Hello, Alice"

# in node B
s = "Hello, Bob"
```

How to reconcile those?
- `Hello, ABloibce`
- `Hello, AliceBob`
- `Hello, BobAlice`
- `Hello, Alice`
- `Hello, Bob`

---

Existing CRDTs differ:
- performance
- storage
- compression
- metadata overhead

---

Hint towards the "automerge" CRDT

---

*show comparison table, page 9*

---

# Part 2

Critique

---

### Software license

> In our opinion, maintaining control and ownership of data does not mean that
> the software must necessarily be open source.

---

#### Example 1 - intentional restriction

```bash
#!/bin/sh

TODAY=$(date +%s)
LICENSE_EXPIRATION=$(date -d 2020-10-27 +%s)

if [ $TODAY -ge $LICENSE_EXPIRATION ]; then
  echo 'License expired!'
  exit 1
fi

echo $((2 + 2))
```

```bash
# today
$ ./useful-adder.sh
4
# tomorrow
$ ./useful-adder.sh
License expired!
```

---

#### Example 2 - unintentional restriction

```bash
# today
$ useful-program
# ...useful output...

# tomorrow, with more data
$ useful-program
ERROR: Panic! Stack overflow!
```
---

### local-first **requires** free software

Otherwise "The Long Now" (ideal nº5) is lost

---

### Denial of existing solutions

> In principle it is possible to collaborate without a repository service,
> e.g. by sending patch files by email, but the majority of Git users rely
> on GitHub.

Solution: either  GitHub+CRDTs or `git` **`send-email`**

---

### Plain text formats

> Git is highly optimized for code and similar line-based text file

It even pulls software to the plain text direction, e.g.:
- delivery-templates
- `common-core.protocols.config`

Why not exploit that more?

---

### Ditching of web applications

> The architecture of web apps remains fundamentally server-centric

Disagree. Contrast [PouchDB][pouchdb] with Android [Instant Apps][instant-apps]

[pouchdb]: https://pouchdb.com/
[instant-apps]: https://developer.android.com/topic/google-play-instant

???

Talk on dynamic content

---

### Costs are underrated

- storage
- backups
- maintenance

Example: blog vs vlog

---

### Real-time collaboration a bit overrated

It is only possible on the presence of reliable, medium-quality network
connection

> X also works when inside an elevator, subway or plane!

<!-- 🤦‍ -->

---

### On CRDTs and developer experience

> For an app developer, how does the use of a CRDT-based data layer compare to
> existing storage layers like a SQL database, a filesystem, or CoreData? Is a
> distributed system harder to write software for?

Yes.

See "[A Note on Distributed Computing][note-dist-comp]"

[note-dist-comp]: https://web.archive.org/web/20130116163535/http://labs.oracle.com/techrep/1994/smli_tr-94-29.pdf

---

## Conclusion

Why this is a "paper I love": it took offline-first and ran with it.

But a pinch of CRDT won't make the world local-first.

The tricky part is the end of the sentence: "**in spite of the Cloud**".

---

## Thank you!

References:

1. "[Local-First Software: You Own Your Data, in spite of the Cloud](https://martin.kleppmann.com/papers/local-first.pdf)", by M. Kleppmann, A. Wiggins, P. Van Hardenberg and M. F. McGranaghan
1. [The Morning Paper](https://blog.acolyer.org/2019/11/20/local-first-software/) article
1. "[A Note on Distributed Computing](https://web.archive.org/web/20130116163535/http://labs.oracle.com/techrep/1994/smli_tr-94-29.pdf)", by J. Waldo, G. Wyant, A. Wollrath and S Kendall